package LexicoBACKUP;

import Sintactico.SlkToken;

/**
 * This class represents a lexical token.
 * It stores it's type, state, line, column and atributes.
 * It also stores if it's already been used by the parser.
 */
public class Token {
	public int tipo;
	public int parse_state;
	boolean used_by_parser;
	public int linea;
	public int columna;
	public Object atributo;
	
	/**
	 * Token constructor.
	 * @param arg0 the token type
	 * @param arg1 the token line
	 * @param arg2 the token column
	 * @param arg3 the token atributes
	 */
	public Token(int arg0, int arg1, int arg2, Object arg3){
		this.tipo = arg0;
		this.linea = arg1;
		this.columna = arg2;
		this.atributo = arg3;
	}
	
	/**
	 * Token constructor.
	 * @param arg0 the token type
	 * @param arg3 the token atributes
	 */
	public Token(int arg0, Object arg3){
		this.tipo = arg0;
		this.atributo = arg3;
	}
	
	/**
	 * Token constructor.
	 * @param arg0 the token type
	 */
	public Token(int arg0){
		this.tipo = arg0;
	}
	
	/**
	 * Displays a token's information in a String form, for display purpose.
	 */
	public String toString(){
		String string = new String();
		string += TipoToken.values()[this.tipo];
		string += " " + atributo.toString();
		string += " Linea: " + this.linea;
		string += " Columna: " + this.columna;		
		return string;
	}	

}